package com.sright.bcard.common.service.share.enums;

/**
 * 企业素材枚举类
 * 1：名片背景视频（名片）\n2：图片（名片）\n3：logo（名片）\n4：企业宣传视频（视频）
 * \n5：宣传视频背景图\n6：竖视频\n7：长图片\n8：横视频\n9：分享图
 */
public enum MaterialTypeEnum {

    CARD_BACKGROUND_VEDIO("名片背景视频（名片）" , 1),
    PICTURE("图片（名片）", 2),
    LOGO("logo（名片）", 3),
    ENTERPRISE_PROPAGATE_VEDIO("企业宣传视频（视频）", 4),
    PROPAGATE_VEDIO_BACKGROUND_PICATURE("宣传视频背景图", 5),
    ENDWAYS_VEDIO("竖视频", 6),
    LONG_PICTURE("长图片", 7),
    HORIZONTAL_PICTURE("横视频", 8),
    SHARE_PICTURE("分享图", 9)
    ;
    private String name;

    private Integer code;

    MaterialTypeEnum(String name, Integer code) {
        this.name = name;
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static MaterialTypeEnum getEnum(String name) {
        try {
            return valueOf(name);
        } catch (Exception e) {
            return null;
        }
    }


    public static MaterialTypeEnum getEnumByValue(String value) {
        if (value == null) {
            return null;
        }

        for (MaterialTypeEnum item : MaterialTypeEnum.values()) {
            if (item.getValue().equals(value)) {
                return item;
            }
        }
        return null;
    }

    public Integer getValue() {
        return code;
    }

    public void setValue(Integer code) {
        this.code = code;
    }
}
